void main(List<String> args) async {
  // 自定义进度条
  final total = 1000;
  var current = 0;

  void updateProgress(int value) {
    current = value;
    final percent = (current / total * 100).toStringAsFixed(1);
    final filled = (current / total * 50).floor(); // 进度条长度为50
    final empty = 50 - filled;
    final bar = '█' * filled + '.' * empty;
    print('Loading: $bar $current/$total $percent%');
  }

  // 模拟加载过程
  for (var i = 0; i < 500; i++) {
    updateProgress(i);
    await Future.delayed(Duration(milliseconds: 10));
  }

  // 修改描述和总数
  await Future.delayed(Duration(seconds: 2));
  final newTotal = 750;
  current = 0; // 重置进度
  void updateNewProgress(int value) {
    current = value;
    final percent = (current / newTotal * 100).toStringAsFixed(1);
    final filled = (current / newTotal * 50).floor(); // 进度条长度为50
    final empty = 50 - filled;
    final bar = '█' * filled + '.' * empty;
    print('Processing: $bar $current/$newTotal $percent%');
  }

  await Future.delayed(Duration(seconds: 2));

  // 继续模拟加载过程
  for (var i = 0; i < 250; i++) {
    updateNewProgress(i);
    await Future.delayed(Duration(milliseconds: 5));
  }

  print("\nDone");
}